import * as Cesium from '@cesiumjs';
import {
  G3xObj
} from "@g3xbase"
import * as g3xUtils from "@g3x/utils";
import * as g3vUtils from "@g3v/utils";

/* 480 */
/***/

class Contour extends G3xObj {

  constructor(ramp) {

    super(ramp);
    var _this = this;
    _this.ramp = ramp;
  }
}

g3xUtils.g3x_defineClassProperties(ElevationRamp, [{
  key: '_apply',
  value: function _apply() {
    if (!this.enabled) return;
    //获取当前globe设置的材质，如果材质上没有
    var material = this._ramp._globe.material;
    if (!material) return;
    var uniforms = void 0;
    if (material.type == 'ElevationRamp') {
      uniforms = material.uniforms;
    } else if (material.materials && material.materials.shading) {
      if (material.materials.shading.type == 'ElevationRamp') uniforms = material.materials.shading
        .uniforms;
    }

    if (!uniforms) return;

    //最小和最大高度
    uniforms.minimumHeight = this.minHeight;
    uniforms.maximumHeight = this.maxHeight;
    //设置image
    uniforms.image = this._ramp._createImage(this.image);
  }
}]);

ElevationRamp.defaultOptions = {
  /**
   * 高程着色分析 和 坡向分析启用 、坡度着色分析互斥
   * @type {boolean}
   * @default false
   * @instance
   * @memberof ElevationRamp
   */
  enabled: false,
  /**
   * 最小高程
   * @type {number}
   * @default 0
   * @instance
   * @memberof ElevationRamp
   */
  minHeight: 0,
  /**
   * 最大高程
   * @type {number}
   * @default 5000
   * @instance
   * @memberof ElevationRamp
   */
  maxHeight: 5000,
  /**
   * 高程分析的色带图片
   * @type {string}
   * @default ''
   * @instance
   * @memberof ElevationRamp
   */
  image: ''
};

// _XbsjObject3.default.registerType(ElevationRamp, 'ElevationRamp');

export default ElevationRamp;
